package cn.doit.sparkcore2json

import org.apache.spark.{SparkConf, SparkContext}

/**
  * Created by ZHAOXUHUA 
  * .           on 2018/11/30.
  */
object AppDataAnaly {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf()
      .setMaster("local[*]")
      .setAppName(this.getClass.getSimpleName)
    val sc = new SparkContext(conf)
    val file = sc.textFile("D:/学习专用/项目/项目四资料/DAY11/app_dict.txt")
    val appNameData = file.map(t => {
      try {
        val split = t.split("\t")
        val appid = split(4)
        // val appname = split(1)
        //(appname, appid)
        appid
      } catch {
        case e:Exception => {
          e.printStackTrace()
        }
      }
    })
    appNameData.saveAsTextFile("appnameData")

    sc.stop()
  }
}
